<!DOCTYPE html>
<html>
<head>
    <title>仓库位置</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.posName" @on-enter="query" placeholder="货位名称"></i-input>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
	    <table id="jqGrid"></table>
    </div>
</div>

<script>

    var storeId = getQueryString("id");
    $(function () {
        $("#jqGrid").Grid({
            url: '../storeposition/list?storeId=' + storeId,
            colModel: [
                // {label: '删除标识', name: 'delFlag', index: 'DEL_FLAG', width: 80},
                // {label: '创建日期', name: 'createDate', index: 'CREATE_DATE', width: 80},
                {label: '仓库编码', name: 'storeId', index: 'STORE_ID', width: 80},
                {label: '货位名称', name: 'posName', index: 'POS_NAME', width: 80},
                {label: '货位排 ', name: 'posRow', index: 'POS_ROW', width: 80},
                {label: '货位架', name: 'posShelf', index: 'POS_SHELF', width: 80},
                {label: '货位层', name: 'posLayer', index: 'POS_LAYER', width: 80},
                {label: '货位号', name: 'posNo', index: 'POS_NO', width: 80},
                {
                    label: '货位类型', name: 'posType', index: 'POS_TYPE', width: 80, formatter: function (value) {
                        return sysEnums.POS_TYPE[value];
                    }
                },
                // {label: '仓库ID', name: 'storeId', index: 'STORE_ID', width: 80},
                // {label: '备注', name: 'remark', index: 'REMARK', width: 80},
                {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
            ]
        });
    });

    let vm = new Vue({
        el: '#rrapp',
        data: {
            showList: true,
            title: null,
            storePosition: {},
            ruleValidate: {
                posName: [
                    {required: true, message: '货位名称不能为空', trigger: 'blur'}
                ],
                posRow: [
                    {required: true, message: '货位排不能为空', trigger: 'blur'}
                ]
            },
            q: {
                posName: ''
            },
            posTypeList: enumsToList('POS_TYPE') //货位类型
        },
        methods: {
            query: function () {
                vm.reload();
            },
            reload: function (event) {
                vm.showList = true;
                let page = $("#jqGrid").jqGrid('getGridParam', 'page');
                $("#jqGrid").jqGrid('setGridParam', {
                    postData: {'posName': vm.q.posName},
                    page: page
                }).trigger("reloadGrid");
                vm.handleReset('formValidate');
            },
            reloadSearch: function () {
                vm.q = {
                    posName: ''
                };
                vm.reload();
            },
            handleReset: function (name) {
                handleResetForm(this, name);
            }
        }
    });


    var getStorePosition = function () {
        let result = getSelectedRowData("#jqGrid");
        var id = result.id;
        alert(id);
        if (id == null) {
            return false;
        } else {
            return result;
        }
    }
</script>
</body>
</html>
